<template>
    <div id="app">
        <router-view />
    </div>
</template>

<script>
    export default {
        components: {
        },
        data() {
            return {
            }
        },
        methods: {
            setIcon() {
                let baseInfo = this.$store.state.app.baseInfo
                if (baseInfo) {
                    var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
                    link.type = 'image/svg+xml';
                    link.rel = 'icon';
                    link.href = baseInfo.websiteIcoLogUrl;
                    document.getElementsByTagName('head')[0].appendChild(link);
                }

            }
        },
        watch: {
            '$store.state.app.baseInfo'(newValue, oldValue) {
                if (newValue !== oldValue) {
                    this.setIcon()
                }
            }
        },
        created() {
            hideSplashScreen()
            this.setIcon()
            // console.log("app.vue",window.location.href);

        },
        mounted() {
        },
        beforeDestroy() {
            // 在组件销毁前取消对基本信息的监听
            this.$store.state.app.baseInfo = null
        }
    }
</script>

<style lang="scss" >
    html {
        height: 100%;
    }

    body {
        margin: 0px;
        height: 100%;
        background-color: #f4f5f7;
    }

    * {
        padding: 0;
        margin: 0;
    }

    #app {
        font-family: Avenir, Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    nav {
        padding: 30px;
        a {
            font-weight: bold;
            color: #2c3e50;

            &.router-link-exact-active {
                color: #42b983;
            }
        }
    }
</style>
